<template>
  <div>
    <h4>岗位介绍</h4>
    <p v-html="row.description"></p>
    <br>
    <h4>任职要求</h4>
    <p v-html="row.requirement"></p>

    <Button class="sub_btn" size="large" @click="submitJob">现在申请</Button>

  </div>
</template>
<script>
  import jobApi from '../api/axios/jobApi'


  export default {
    props: {
      row: Object
    },
    computed: {
      getUserId (){
        return this.$store.getters['auth/getUserId'];
      },
      getLoginSessionState (){
        return this.$store.getters['auth/getLoginSessionState'];
      }
    },
    methods: {
      submitJob (){
        if (this.getLoginSessionState.online){
          let that = this;
          jobApi.submitJobWish({
            userId: that.getUserId,
            jobId: that.row.id
          },{
            success (res) {
              if (res.data.status === 200) {
                that.$Message.success("提交成功");
              }else {
                that.$Message.error("您已申请某一职位");
                console.log("submitJobWish 请求失败：" + res.data);
              }
            }
          });
        }else {
          this.$Message.error("请您先登录！");
        }
      }
    }
  }
</script>
<style>
  .sub_btn {
    margin-top:10px;
    width: 120px;
  }
</style>
